﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WaterRevenueMS.Domain.Common.Models;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace WaterRevenueMS.Domain.ViewModels.Customer.Customer
{
    public class CustomerModel : EntityCommon
    {
        public CustomerModel()
        {
            BankItems = new List<SelectListItem>
            {
                new SelectListItem{Text="请选择开户银行",Value="0"}
            };
            MeterBookItems = new List<SelectListItem>
            {
                new SelectListItem{Text="请选择所属表册",Value="0"}
            };
            AccountStateItems = new List<SelectListItem>();
            Search = new SearchModel();
        }
        public int Id { get; set; }

        [Display(Name = "用户编号")]
        [StringLength(16,ErrorMessage="用户编号不能大于{1}个字符")]
        [Remote("IsUnique_Available", "Customer", ErrorMessage = "该编号已经存在")]
        public string Yong_HBH { get; set; }

        [Display(Name = "户主姓名")]
        [Required(ErrorMessage = "户主姓名不能为空")]
        [StringLength(16,MinimumLength=1, ErrorMessage = "户主姓名{2}~{1}个字符")]
        public string Hu_ZXM { get; set; }

        [Display(Name = "联系电话")]
        [Required(ErrorMessage = "联系电话不能为空")]
        [StringLength(32, MinimumLength = 1, ErrorMessage = "联系电话{2}~{1}个字符")]
        [RegularExpression(@"\d+", ErrorMessage = "必须是数字")]
        public string Lian_XDH { get; set; }

        [Display(Name = "用户住址")]
        [Required(ErrorMessage="用户地址不能为空")]
        [StringLength(128, MinimumLength = 1, ErrorMessage = "用户住址{2}~{1}个字符")]
        public string Yong_HDZ { get; set; }

        [Display(Name = "住房面积")]
        [StringLength(32,ErrorMessage="住房面积不能大于{1}个字符")]
        public string Zhu_FMJ { get; set; }

        

        [Display(Name="户主性别")]
        [StringLength(8,ErrorMessage="户主性别不能大于{1}个字符")]
        public string Hu_ZXB { get; set; }

        

        [Display(Name="身份证")]
        [StringLength(32,ErrorMessage="身份证号不能大于{1}个字节")]
        public string Shen_FZH { get; set; }

        [Display(Name="家庭成员")]
        [StringLength(32,ErrorMessage="家庭成员不能大于{1}个字符")]
        public string Jia_TCY { get; set; }

        [Display(Name="工作单位")]
        [StringLength(64,ErrorMessage="工作单位不能大于{1}个字符")]
        public string Gong_ZDW { get; set; }

        public int? Yin_HSZ_No { get; set; }

        [Display(Name="开户银行")]
        public string BankName { get; set; }
        public List<SelectListItem> BankItems { get; set; }
        
        [Display(Name="银行帐号")]
        [StringLength(32,ErrorMessage="银行帐号不能大于{1}个字符")]
        [RegularExpression(@"\d+", ErrorMessage = "必须是数字")]
        public string Yin_HZH { get; set; }

        public int OrderNo { get; set; }

        [Display(Name="账户余额")]
        public float Zhang_HYE { get; set; }

        [Display(Name="账户状态")]
        [StringLength(16,ErrorMessage="账户状态不能大于{1}个字符")]
        public string Zhang_HZT { get; set; }
        public List<SelectListItem> AccountStateItems { get; set; }


        [Display(Name="余额报警线")]
        public float Yu_EBJX { get; set; }

        [Display(Name="余额停用线")]
        public float Yu_ETYX { get; set; }

        [Display(Name = "所属表册")]
        [RegularExpression(@"^\+?[1-9][0-9]*$",ErrorMessage="请选择所属表册")]
        public int? Biao_CSZ_No { get; set; }
        [Display(Name="表册名称")]
        public string MeterBookName { get; set; }
        public List<SelectListItem> MeterBookItems { get; set; }

        public byte RuleOfCode { get; set; }

        public SearchModel Search { get; set; }

    }
    public class SearchModel
    {
        public SearchModel()
        {
            MeterBookItems = new List<SelectListItem>
            {
                new SelectListItem{Text="请选择所属表册",Value="0"}
            };
        }

        [Display(Name = "用户编号")]
        public string Yong_HBH { get; set; }

        [Display(Name = "户主姓名")]
        public string Hu_ZXM { get; set; }

        [Display(Name = "联系电话")]
        public string Lian_XDH { get; set; }

        [Display(Name = "身份证")]
        public string Shen_FZH { get; set; }

        [Display(Name = "用户住址")]
        public string Yong_HZZ { get; set; }

        [Display(Name = "所属表册")]
        public int? Biao_CSZ_No { get; set; }
        public List<SelectListItem> MeterBookItems { get; set; }
    }
}
